import axios from '@/libs/api.request'
export default class MailApi {
  // 写邮件/回复邮件
  static addMail = params => {
    return axios.request({
      url: '/MailManage/Add',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 获取列表
  static getMailList = params => {
    return axios.request({
      url: '/MailManage/GetList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取详情
  static getDetail  = params => {
    return axios.request({
      url: '/MailManage/GetModel',
      method: 'get',
      params: params
    })
  }

  //下载附件
  static downloadAttr = params => {
    return axios.request({
      url: '/MailManage/Download',
      method: 'get',
      params: params,
      responseType: 'blob'
    })
  }

  //删除附件
  static DeleteAnnex = params => {
    return axios.request({
      url: '/MailManage/DeleteAnnex',
      method: 'delete',
      data: params
    })
  }

  // 获取平台账号
  static GetVisibleTreeList = params => {
    return axios.request({
      url: '/MailManage/GetVisibleTreeList',
      method: 'get',
      params: params
    })
  }

  // 获取客户账号
  static GetUserList = params => {
    return axios.request({
      url: '/User/GetList',
      method: 'post',
      data: params
    })
  }

  // 获取客户账号new
  static GetMailUserList = params => {
    return axios.request({
      url: '/User/GetMailUserList',
      method: 'post',
      data: params
    })
  }

  // 回收邮件
  static DeleteMail = (type,params) => {
    return axios.request({
      url: '/MailManage/Delete?type=' + type,
      method: 'post',
      data: params
    })
  }

  // 全部置为已读
  static Update = (params) => {
    return axios.request({
      url: '/MailManage/Update',
      method: 'post',
      data: params
    })
  }

  // 再次编辑
  static GetEditAgainModel = (params) => {
    return axios.request({
      url: '/MailManage/GetEditAgainModel',
      method: 'get',
      params: params
    })
  }

  // 撤回
  static Withdraw = (params) => {
    return axios.request({
      url: '/MailManage/Withdraw',
      method: 'get',
      params: params
    })
  }
}